<template>
	<view class="content">
		<navbar title='试卷列表'>
		</navbar>
		<!-- <uv-navbar leftIcon="arrow-leftward" title="试卷列表" leftIconColor="#333" placeholder autoBack bgColor="#fff" :titleStyle="titleStyle"></uv-navbar> -->
		<u-sticky offset-top="0">
			<view class="souview">
				<view class="shaiview" @click="classshow=true">
					<text class="shainame">{{ bankinfo.name?bankinfo.name:'筛选分类' }}</text>
					<image class="icon_sx" src="@/static/new/icon_sx.png"></image>
				</view>
				
			</view>
		</u-sticky>
		<view class="fone plr">

			<view class="list">
				<view class="item" v-for="(item,index) in paper" :key="index">
					<view class="itemone">
						<text class="xname">{{item.name}}</text>
						<!-- <view class="guan">
							行政管理
						</view> -->
					</view>
					<text class="kao">开始时间：<text class="time">{{ item.start_date }}</text></text>
					<text class="kao">截止时间：<text class="time">{{item.end_date}}</text></text>
					<view class="chakan">
						<view class="chaview" @click="getDetail(item)">
							查看
						</view>
					</view>
				</view>
				<view class="nodata" v-if="paper == ''">
					<u-empty text="暂无数据" mode="list" ></u-empty>
				</view>
			</view>
		</view>

		<!-- 下拉数据 -->
		<u-select v-model="classshow" :list="bank" @confirm="classconfirm" label-name="name" value-name="id"></u-select>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				titleStyle:{
					fontWeight: 'bold',
					fontSize: '36rpx',
					color: '#111111',
				},
				value:'',
				bank:[],
				bankinfo:{
					name:""
				},
				paper:[],
				paperinfo:{
					topic_number:'',
					id:''
				},
				classshow:false,
				classlist:[]

			}
		},
		onLoad() {
			this.gettiClass()
		},
		onShow() {
		},
		methods: {
			async gettiClass(){
				let res = await this.$u.api.tibank({
				});
				this.bank = res.bank
				this.bankinfo = res.bank[0]
				this.gettilist()
			},
			async gettilist(){
				let res = await this.$u.api.tipaper({
					bank_id:this.bankinfo.id,
					only_room:'0'
				});
				this.paper = res.paper
				if(res.paper!=''){
					this.paperinfo = res.paper[0]
				}else{
					this.paperinfo = {
						topic_number:'',
						id:''
					}
				}
				
			},
			getDetail(item){
				this.navrouter("/pages/StudPage/TimuCha?id="+item.id);
			},
			classconfirm(e){
				console.log(e)
				this.bankinfo.name = e[0].label
				this.bankinfo.id = e[0].value
				this.gettilist()
			},
		}
	}
</script>

<style scoped lang="scss">
	.content {
		min-height: 100vh;
		background-color: #f5f5f5;
		

		.souview{
			background-color: #fff;
			padding: 20rpx 30rpx;
			display: flex;
			flex-direction: row;
			align-items: center;
			.shaiview{
				display: flex;
				flex-direction: row;
				align-items: center;
				padding: 15rpx;
				background: #EEEEEE;
				border-radius: 10rpx;
				.shainame{
					font-weight: 500;
					font-size: 24rpx;
					color: #51565D;
				}
				.icon_sx{
					width: 24rpx;
					height: 24rpx;
					margin-left: 10rpx;
				}
			}
			
			.souitem{
				height: 78rpx;
				background: #F5F5F5;
				border-radius: 39rpx;
				display: flex;
				align-items: center;
				flex-direction: row;
				padding: 0 23rpx;
				width: 100%;
				.icon_sousuo{
					width: 24rpx;
					height: 24rpx;
					margin-right: 15rpx;
				}
				.soubtn{
					margin-left: 20rpx;
					width: 100rpx;
					height: 50rpx;
					background: #3E65E5;
					border-radius: 25rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 24rpx;
					color: #FFFFFF;
				}
			}
		}
		.fone{
			margin-top: 40rpx;
			.flist{
				display: flex;
				flex-direction: row;
				flex-wrap: wrap;
				.fitem{
					width: 25%;
					display: flex;
					flex-direction:column;
					align-items: center;
					justify-content: center;
					margin-bottom: 44rpx;
					text{
						display: inline-block;
						margin-top: 13rpx;
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #666666;
					}
					.ficon{
						width: 80rpx;
						height: 80rpx;
					}
				}
			}
			.shenhe{
				height: 60rpx;
				background: #F3F6F9;
				border-radius: 10px;
				padding: 0 30rpx;
				display: flex;
				flex-direction: row;
				align-items: center;
				.shenitem{
					width: 33.33%;
					display: flex;
					flex-direction: row;
					align-items: center;
					border-right: 1rpx solid rgba(62,101,229,0.3);
					justify-content: center;
					.shenone{
						margin-right: 3rpx;
						width: 33rpx;
						height: 33rpx;
					}
					.shentit{
						font-family: PingFang SC;
						font-weight: 400;
						font-size: 24rpx;
						color: #3C66DE;

					}
				}
				.shenitem:last-child{
					border-right: none;
				}
			}

			.leiview{
				width: 100%;
				.leiscview{
					white-space: nowrap;
					// overflow-x: auto;
					.leiitem{
						display: inline-block;
						padding: 20rpx 40rpx;
						background: #EEEEEE;
						border-radius: 16rpx;
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #666666;
						margin-right: 20rpx;
					}
					.lactive{
						background: #3E65E5;
						color: #fff;

					}
				}
				
			}
		}
		.list{
			display: flex;
			flex-direction: row;
			flex-wrap: wrap;
			margin-top: 30rpx;

			.item{
				width: 100%;
				display: flex;
				flex-direction: column;
				margin-bottom: 20rpx;
				background-color: #fff;
				border-radius: 10rpx;
				padding: 0 30rpx 20rpx;
				position: relative;
				// border: 1rpx solid #eee;
				// box-shadow: 0px 3rpx 9rpx 0px rgba(109,109,109,0.1);
				.itemone{
					display: flex;
					flex-direction: row;
					align-items: center;
					padding: 30rpx 0;
					border-bottom: 1rpx solid #EEEEEE;

					.xname{
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 30rpx;
						color: #000;
					}
					.guan{
						position: absolute;
						right: 0;
						width: 140rpx;
						height: 44rpx;
						background: #3E65E5;
						border-radius: 22rpx 0rpx 2rpx 22rpx;
						display: flex;
						align-items: center;
						justify-content: center;
						font-weight: 500;
						font-size: 24rpx;
						color: #EAEFFF;
					}
				}
				.kao{
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 28rpx;
					color: #666666;
					display: inline-block;
					margin-right: 5rpx;
					// padding: 20rpx 0;
					margin-top: 20rpx;
				}
				.time{
					font-weight: 500;
					font-size: 28rpx;
					color: #3E65E5;
				}
				.tubg{
					width: 100%;
					height: 330rpx;
					margin-bottom: 20rpx;
				}
				.botview{
					display: flex;
					flex-direction: column;
					padding: 20rpx ;
				}
				.biaoti{
					display: inline-block;
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 26rpx;
					color: #333333;
				}
				.pjia{
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 26rpx;
					color: #E53E3E;
					display: block;
					margin-top: 20rpx;
					.pnum{
						font-size: 36rpx;
					}
				}
			}
			.item:nth-child(even){
				margin-left: auto;
			}
		}
		.txt {
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
		}
		.plr{
			padding: 0 30rpx;
		}
		.ftit{
			display: block;
			margin-bottom: 30rpx;
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 36rpx;
			color: #111111;
		}



	}
	.chakan{
		margin-top: 30rpx;
		display: flex;
		align-items: center;
		justify-content: flex-end;
		.chaview{
			background: #3E65E5;
    		color: #fff;
			height: 30px;
			border-radius: 5px;
			border: 1px solid #3E65E5;
			margin: 0 6px;
			width: 80px;
			display: flex;
			align-items: center;
			justify-content: center;
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 14px;
		}
	}
</style>